﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kokomo.Xml
{
	public abstract class PropertySchema
	{
		public PropertySchema(string nodeName, Type propertyType, PropertyNodeType nodeType, PropertySchemaFlags flags)
		{
			ArgumentValidation.CheckNullArgument("nodeName", nodeName);
			ArgumentValidation.CheckNullArgument("propertyType", propertyType);

			this.NodeName = nodeName;
			this.PropertyType = propertyType;
			this.NodeType = nodeType;
			this.Flags = flags;
		}

		public string NodeName { get; private set; }
		public Type PropertyType { get; private set; }
		public PropertyNodeType NodeType { get; private set; }
		public PropertySchemaFlags Flags { get; private set; }
		public bool UseImplicitList { get { return (this.Flags & PropertySchemaFlags.ImplicitList) != 0; } }

		public abstract object GetValue(object target);
		public abstract void SetValue(object target, object value);
	}
}
